package org.budo.poi.util;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;

/**
 * @author limingwei
 */
public class RowUtil {
    public static Object getCellValue(Row row, int cellnum) {
        Cell cell = row.getCell(cellnum);
        return CellUtil.getCellValue(cell);
    }

    public static String getCellValueString(Row row, int cellnum) {
        Object cellValue = getCellValue(row, cellnum);
        return null == cellValue ? null : cellValue.toString();
    }

    public static Integer getCellValueInteger(Row row, int cellnum) {
        Object cellValue = getCellValue(row, cellnum);
        return null == cellValue ? null : new Integer(cellValue.toString());
    }

    public static Double getCellValueDouble(Row row, int cellnum) {
        Object cellValue = getCellValue(row, cellnum);
        return null == cellValue ? null : new Double(cellValue.toString());
    }
}